package minimips.isa.itype;

import minimips.isa.InstructionSpecification;

public class ITypeSpecification extends InstructionSpecification {

	private int rs, rt, immediate;
	
	public ITypeSpecification(int opcode, int rs, int rt, int immediate) {
		super(opcode);
		this.rs = rs;
		this.rt = rt;
		this.immediate = immediate;
	}

	public int getRs() {
		return rs;
	}

	public int getRt() {
		return rt;
	}

	public int getImmediate() {
		return immediate;
	}

	@Override
	public int getMachineCode() {
		int machineCode = this.getOpcode() << 6 | rs;
		machineCode = machineCode << 5 | rt;
		machineCode = machineCode << 5 | immediate;
		return machineCode;
	}

}
